-
Notifications
You must be signed in to change notification settings - Fork 352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change ChannelId representation to String #2361
Conversation
ICS 024 does not restrict channel IDs to the "channel-{N}" format.
- Create valid IDs with ChannelId::new (could be under valid length). - Format as the inner string with Display. - Derive Debug, no need for a manual definition, which printed it wrong.
Contrary to what is still documented in ICS 024, the minimum length accepted by ibc-go is 8 characters: https://github.com/cosmos/ibc-go/blob/e04964912c266bab923253c48d72cc8ec8b38f5e/modules/core/24-host/validate.go#L76-L81
The length limit is now 64 characters in accordance with ICS 024 and ibc-go, but longer than previous code admitted.
- File under the modules component. - Add an entry to bug-fixes mentioning the corrected enforcement of the length limit on channel IDs.
/// A valid Identifier must be between 10-64 characters and only contain lowercase | ||
/// alphabetic characters, | ||
pub fn validate_channel_identifier(id: &str) -> Result<(), Error> { | ||
validate_identifier(id, 8, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is discrepancy between the spec and the code here. The spec says channel ids must be 10 characters long or more but that would mean that channel-0
is not a valid channel id. We should clarify that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarified offline, the spec is wrong. Let's update the comment above then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for grinding through all this 🙏
ICS 024 does not restrict channel IDs to the "channel-{N}" format. Change the internal representation of ChannelId to String, and modify the API accordingly to the similar ID types. --- * Change ChannelId representation to String ICS 024 does not restrict channel IDs to the "channel-{N}" format. * More clone calls for ChannelId, clippy fixes * fmt fix * Changelog entry for informalsystems#2361 * ChannelId formatting fixes - Create valid IDs with ChannelId::new (could be under valid length). - Format as the inner string with Display. - Derive Debug, no need for a manual definition, which printed it wrong. * Relax the channel identifier valid length Contrary to what is still documented in ICS 024, the minimum length accepted by ibc-go is 8 characters: https://github.com/cosmos/ibc-go/blob/e04964912c266bab923253c48d72cc8ec8b38f5e/modules/core/24-host/validate.go#L76-L81 * Add unit tests for validate_channel_identifier * Tweak test data for excessively long channel IDs The length limit is now 64 characters in accordance with ICS 024 and ibc-go, but longer than previous code admitted. * Improve changelog entries for informalsystems#2361 - File under the modules component. - Add an entry to bug-fixes mentioning the corrected enforcement of the length limit on channel IDs. * Fix outdated comment * Clarify comment Co-authored-by: Romain Ruetschi <[email protected]>
Closes: cosmos/ibc-rs#39
Description
ICS 024 does not restrict channel IDs to the "channel-{N}" format.
Change the internal representation of
ChannelId
toString
, and modify the API accordingly to the similar ID types.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.